<!DOCTYPE html>
<html lang="en"  style="overflow-x:hidden;">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>{eq name="ADMINTYPE" value="2"}加盟商{/eq}管理后台</title>
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <meta name="apple-mobile-web-app-title" content="管理后台" />
    {include file="common:css" /}
</head>

<body>
{block name="form"/}
{/block}
{include file="common:js" /}
<script type="text/javascript">

    $('.widget').css('min-height',($(document).height()-30)+'px');
    var is_ajax = 1;
    function add(url,form) {
         if(is_ajax ==0) return;
        is_ajax =0;
        var data = $(form).serializeArray();
        for(var j=0;j<data.length;j++){
            if(data[j].name.charAt(data[j].name.length-1) !=']'){
                var obj = $('input[name='+data[j].name+']').eq(0);
                if(!required){
                    obj =  $('select[name='+data[j].name+']').eq(0);
                }
                var required = obj.attr('required');
                if(required == 'required'){
                    if(!obj.val()){
                        var name = obj.parent('div').prev('label').html();
                        layer.alert(name+"不能为空！",{icon:5})
                        return;
                    }
                }
            }

        }
        $.post(url,$(form).serialize(),function (res) {
            is_ajax =1;
            if(res.code!=0){
                layer.alert(res.msg,{icon:5})
            }else{
                layer.alert('操作成功!',{icon:6},function () {
                    var index = parent.layer.getFrameIndex(window.name);
                    window.parent.location.reload();
                    parent.layer.close(index);//关闭当前页

                })
            }
        },'json')
    }


</script>
{block name='script'}{/block}
</body>
</html>